package com.mydomain.Bodega;

import com.mydomain.Bodega.*;
import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.framework.EntityHome;

@Name("invDetalleHome")
public class InvDetalleHome extends EntityHome<InvDetalle> {

	@In(create = true)
	InvComprasHome invComprasHome;
	@In(create = true)
	InvItemStockHome invItemStockHome;

	public void setInvDetalleDetCodItem(String id) {
		setId(id);
	}

	public String getInvDetalleDetCodItem() {
		return (String) getId();
	}

	@Override
	protected InvDetalle createInstance() {
		InvDetalle invDetalle = new InvDetalle();
		return invDetalle;
	}

	public void wire() {
		getInstance();
		InvCompras invCompras = invComprasHome.getDefinedInstance();
		if (invCompras != null) {
			getInstance().setInvCompras(invCompras);
		}
		InvItemStock invItemStock = invItemStockHome.getDefinedInstance();
		if (invItemStock != null) {
			getInstance().setInvItemStock(invItemStock);
		}
	}

	public boolean isWired() {
		return true;
	}

	public InvDetalle getDefinedInstance() {
		return isIdDefined() ? getInstance() : null;
	}

}
